function checkUsernameValid(){
    // console.log(obj.value);
    const username = document.querySelector('#username').value
    const pattern = /^[a-zA-Z][a-zA-Z0-9]{3,15}$/
    const username_error = document.querySelector('#username_error')
    if(pattern.test(username)){
        username_error.textContent = '√'
        username_error.classList.remove('error')
        username_error.classList.add('success')
        return true
    }else{
        username_error.textContent = '登录用户名由英文字母和数字组成的4-16位字符，以字母开头'
        username_error.classList.remove('success')
        username_error.classList.add('error')
        return false
    }
}

function checkPasswordValid(){
    const username = document.querySelector('#password').value
    const pattern = /^[a-zA-Z0-9]{4,10}$/
    const pwd_error = document.querySelector('#pwd_error')
    if(pattern.test(username)){
        pwd_error.textContent = '√'
        pwd_error.classList.remove('error')
        pwd_error.classList.add('success')
        return true
    }else{
        pwd_error.textContent = '密码由英文字母和数字组成的4-16位字符'
        pwd_error.classList.remove('success')
        pwd_error.classList.add('error')
        return false
    }
}